<?php $products = $this->products; ?>
<div id="products-container">
	<%
	sort_form($this);
	start_form_tag('a', array('id' => 'products'));
	submit_tag('compare');
	%>
	<div id="product-listing">
	<% foreach ($products as $product): %>
		<div class="product">
			<div class="compare-box">
				<%=	check_box_tag('compare', $product->id); %>
			</div>
			<div class="price">
				<%=	number_to_currency($product->price); %>
				<%=	link_to('Add to Cart', array('action' => 'addToCart', 'id' => $product->id)); %>
			</div>
			<div class="image">
				No image yet
			</div>
			<div class="product-description">
				<%=	link_to(ucfirst($product->name), array('action' => 'viewProduct', 'id' => $product->id)); %>
				<ul>
					<li><%= $product->description; %></li>
					<li>Material: <%= $product->material %></li>
					<li>Dimension: <%= $product->get_dimensions() %></li>
				</ul>
			</div>
		</div>
	<%	endforeach; %>
	</div>
	<%
	submit_tag('compare');
	end_form_tag();
	sort_form($this);
	%>
</div>
<?php
function sort_form($t) {
	start_form_tag('productList/'.$_GET['type'], array('class' => 'sort-form', 'method' => 'get'));
		select_tag('sort', options_for_select($t->sortable, $_COOKIE['pref']['sort']));
		select_tag('perPage', options_for_select($t->per_page_opts, $_COOKIE['pref']['perpage']), array('class' => 'per-page-drop'));
		submit_tag('Go');
	end_form_tag();
}
?>